import * as Types from "../constants"

export default {
	// 用户登录
	[Types.login](state, user) {
		state.user = user
		state.isLogin = true
		uni.setStorageSync("user", user)
	},

	// 用户退出登录
	[Types.logout](state) {
		state.user = {}
		state.userData = {}
		state.userDesc = {}
		state.isLogin = false
		uni.removeStorageSync("user")
	},

	// 获取用户数据
	[Types.getUserData](state, userData) {
		state.userData = userData
	},

	// 获取用户详情
	[Types.getUserDesc](state, userDesc) {
		state.userDesc = userDesc
	}
}
